﻿using System;
using System.Collections.Generic;
using System.Xml;

namespace DashFire.ResourceLoad
{
  /// <summary>
  /// 资源归属于
  /// </summary>
  internal class AssetAssigned
  {
    #region 单例
    public static AssetAssigned Instance { get { return sInstance; } }
    private static AssetAssigned sInstance = new AssetAssigned();
    private AssetAssigned() { }
    #endregion

    public static string GetBundleName(string url)
    {
      var info = GetAssetBundleAssetInfo();
      return info.GetAssetBundleName(url);
    }

    private static AssetBundleAssetInfo GetAssetBundleAssetInfo()
    {
       if(sInfo == null)
      {
        sInfo = new AssetBundleAssetInfo();
        XmlDocument xml = new XmlDocument();
        xml.Load(PathUtil.GetPersistentDataPath("/AssetBundlesAssetInfo.xml"));
        sInfo.LoadXml(xml);
      }

      return sInfo;
    }


    private static AssetBundleAssetInfo sInfo = null;
  }
}
